package main;

public class Demo {
    public static void  feed(Animal animal,String food){
        animal.eat(food);
    }

    public static void main(String[] args) {
        Dog dog = new Dog();
        feed(dog,"骨头");
        Cat cat = new Cat();
        feed(cat,"鱼");
    }

}

abstract class Animal{
    public abstract void eat(String foods);
}

class Dog extends Animal{
    public void eat(String foods){
        System.out.println("Dog"+foods);
    }
}
class Cat extends Animal{
    public void eat(String foods){
        System.out.println("Cat"+foods);
    }
}
